<template>
    <h1>登录信息</h1>

    <table class="table table-bordered" border="2" >
        <thead>
            <tr>
                <th>登录名称</th>
                <th>密码</th>
                <th>状态</th>
                <th>操作</th>
            </tr>
        </thead>

        <tbody>
            <tr >
                <td>{{ Info.U_Name }}</td>
                <td>****</td>
                <td>{{ Info.U_State == true ? '未登录' : '已登录' }}</td>
                <td>
                    <a href="#" @click="jump(Info.U_Id)" >购买理财</a>
                </td>
            </tr>
        </tbody>

    </table>

</template>

<script setup lang="ts">
import { ref,onMounted } from 'vue';
import axios from 'axios';
import { useRouter,useRoute } from 'vue-router';

const route = useRoute();
const router = useRouter();

console.log(route.params.Id);

const Info = ref({
    U_Id:'',
    U_Name:'',
    U_Pwd:'',
    U_State:''
})

onMounted(()=>{
    FTian();
})

const FTian = ()=>{
    axios({
        method:'get',
        url:'http://localhost:62821/api/User/FTian',
        params:{
            Id:route.params.Id
        }
    })
    .then((res)=>{
        console.log(res.data);
        Info.value = res.data;
    })
    .catch((err)=>{
        console.log(err);
    })
}

const jump = (Id:any) =>{
    alert(Id);
    router.push({
        name:'AddFinan',
        params:{
            Id:Id
        }
    })
}


</script>
